package com.fjnldx.mes.service.energyRecord;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjnldx.mes.domain.domainReq.PowerConsumptionOfMachineReq;
import com.fjnldx.mes.domain.domainReq.VarietyPowerConsumptionReq;
import com.fjnldx.mes.domain.domainRes.LineChartRes;
import com.fjnldx.mes.domain.domainRes.PowerConsumptionOfMachineRes;
import com.fjnldx.mes.domain.domainRes.Result;
import com.fjnldx.mes.domain.domainRes.VarietyPowerConsumptionRes;
import com.fjnldx.mes.domain.pojo.EnergyRecordQueryParam;
import com.fjnldx.mes.domain.pojo.PowerConsumptionOfMachineQueryParam;
import com.fjnldx.mes.mapper.energyRecord.EnergyRecordMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EnergyRecordService {

    @Autowired
    private EnergyRecordMapper energyRecordMapper;

    public Result varietyPowerConsumption(VarietyPowerConsumptionReq varietyPowerConsumptionReq, Page page) {
        IPage<VarietyPowerConsumptionRes> resultList = energyRecordMapper.getVarietyPowerConsumption(varietyPowerConsumptionReq, page);
        return Result.success(resultList);
    }


    public Result powerConsumptionOfMachine(PowerConsumptionOfMachineReq powerConsumptionOfMachineReq, Page page) {
        IPage<PowerConsumptionOfMachineRes> result =  energyRecordMapper.getPowerConsumptionOfMachine(powerConsumptionOfMachineReq, page);
        return Result.success(result);
    }

    public Result consumptionOfGongxu(VarietyPowerConsumptionReq varietyPowerConsumptionReq, Page page) {
        IPage<VarietyPowerConsumptionRes> resultList = energyRecordMapper.getConsumptionOfGongxu(varietyPowerConsumptionReq, page);
        return Result.success(resultList);
    }

    public Result lineChart(PowerConsumptionOfMachineReq powerConsumptionOfMachineReq, Page page) {
        IPage<LineChartRes> result =  energyRecordMapper.getLineChart(powerConsumptionOfMachineReq, page);
        return Result.success(result);
    }
}
